//
//  People.m
//  ObjectArchiverDemo
//
//  Created by UniHan_iMac on 17/4/1.
//  Copyright © 2017年 UniHan_iMac. All rights reserved.
//

#import "People.h"

@implementation People

// 实现NSCoding协议
- (void)encodeWithCoder:(NSCoder *)aCoder
{
    [aCoder encodeObject:self.name forKey:@"name"];
    [aCoder encodeInt:self.age forKey:@"age"];
}

- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder
{
    self = [super init];
    if(self)
    {
        self.name = [aDecoder decodeObjectForKey:@"name"];
        self.age = [aDecoder decodeIntForKey:@"age"];
    }
    return self;
}

@end
